//
// Copyright (c) 2024 BPer
//
#ifndef SRC_BPERRTP_BPERRECEIVENACKBUFFER_H_
#define SRC_BPERRTP_BPERRECEIVENACKBUFFER_H_

#include <bperutil/BPerType.h>

typedef struct BPerReceiveNackBuffer{
    uint16_t begin;
     uint16_t end;
	 uint16_t capacity;
	 uint16_t contexttialized;
	 int32_t* queue;
	 uint64_t nn_seq_flip_backs;
}BPerReceiveNackBuffer;

#ifdef __cplusplus
extern "C"{
#endif
void bPer_create_nackBuffer(BPerReceiveNackBuffer* nackbuf,int32_t capacity);
void bPer_destroy_nackBuffer(BPerReceiveNackBuffer* nackbuf);
int32_t bPer_nackbuffer_empty(BPerReceiveNackBuffer* nackbuf);
void bPer_nackbuffer_notify_nack_list_full(BPerReceiveNackBuffer* nackbuf);
void bPer_nackbuffer_notify_drop_seq(BPerReceiveNackBuffer* nackbuf,uint16_t seq);
int32_t bPer_nackbuffer_update(BPerReceiveNackBuffer* nackbuf,uint16_t seq);
int32_t bPer_nackbuffer_update2(BPerReceiveNackBuffer* nackbuf,uint16_t seq, uint16_t* nack_first, uint16_t* nack_last);
void bPer_nackbuffer_set(BPerReceiveNackBuffer* nackbuf,uint16_t at, uint16_t pkt);
uint32_t bPer_nackbuffer_get_extended_highest_sequence(BPerReceiveNackBuffer* nackbuf);
#ifdef __cplusplus
}
#endif
#endif /* SRC_BPERRTP_BPERRECEIVENACKBUFFER_H_ */
